# -*- coding:utf-8 -*-
# print("hello world")
# print("hello world!")
# print("....this is the first "
#       "this is the second "
#       "haha")
# age = 3
# name = "tom"
# print("{0} was {1} years old".format(name, age))
# print(name + "was "+str(age)+"years old ");

# 数据的运算
# import sys
# a = 3
# b = 0
# c = 5.66
# d = 8.0
# e = complex(a, b)
# print(type(a), type(b), type(c))
# print(a + b)
#
# print(sys.argv)

# 字符
# print("您还")
# print("what's your name \n haha")

# list
# number_list = [1,2,3,4,6]
# number_list2 = ["ab","ac","a","abcd",1,2]
#
# print("haha  "+number_list2[0])
#
# number_list[1] = 30
# print("heheh "+str(number_list))
#
# del number_list[1]
# print(str(number_list))

# tuple  本身是不能被更改的 但是 如果里面的是数组  就可以进行 对数组的更改

# a = (2,)
# b = (1,2,['a','b'])
# print(b[1])

# 可以对应的提取到x,y,z
# v = ("x","y","z")
# (a,b,c) = v
# print(a)

# print(len((1,2,3)))
# print((1,2,3)+(2,3,4))


# 数据字典
# test = {"name":"zhangsan","age":19,"sex":"男"}
#
# test1 = {("name","lisi"):"zhangsan","age":19,"sex":"男"}
# print(test1[("name","lisi")])

# 定义函数
# def say_hi():
#     print("hello world")
#
#
# say_hi()
#
#
# def num(a, b):
#     c = a + b
#     print(c)
#
#
# num(1, 2)
#
#
# def repeatd(str,num):
#     newStr = str*num
#     return newStr
#
# print(repeatd("zhangsan",3))

# x = 3
# def foo():
#     global x
#     print("x is "+str(x))
#     x = 20
#     print(x)
#
# foo()
# print(x)

# 几个值传入
# def func(a,b=1,c=2):
#     print("a={0},b={1},c={2}".format(a,b,c))
#
# func(b=10,a=80)

# 多个值传入
# def print_args(fpara,*nums,**words):
#     print("fpara="+str(fpara))
#     print("nums="+str(nums))
#     print("words="+str(words))
# print_args("hello world",1,2,3,4,name="zhangsan",sex="nan")

# if 判断语句
# number = 999
# guess =  input("enter in intgeer")
#
# print(type(int(guess)))
# print(type(guess) == int)

# if(guess):
#     guess = guess
# else:
#     guess = 0
#
# guess = int(guess)
# print(guess)

# if (guess > 999):
#     print("高")
# elif (guess < 999):
#     print("低")
# else:
#     print("ok")

# for 语句
# for i in range(1,10):
#     print(i)


# 文件的写入和读取
# some_con = "i love " \
#            "i like a  pretty girl"
# f = open("test.txt","w")
# f.write(some_con)
# f.close


# f = open("test.txt")
# global line
# while True:
#     line = f.readline()
#     if len(line) == 0:
#         f.close
#         break
#     print(line)

# 异常处理
# num = 6
# print("hello world" + num)

# while True:
#     try:
#         x = input("输入数字:")
#         print(int(type(x)))
#         break
#     except ValueError:
#         print("输入的不是数字")

# try:
#     f = open("test.txt")
#     s = f.readline()
#     i = int(s.strip())
# except OSError as err :
#     print("os error :{0}:".format(err))
# except ValueError:
#     print("data not an integer")

# 图形界面
#
# import tkinter
# top = tkinter.Tk()
# top.mainloop()

# from tkinter import  *
# import tkinter.simpledialog as dl
# import tkinter.messagebox as mb
#
# root = Tk()
# w = Label(root,text="Lable Title")
# w.pack()
#
# mb.showinfo("welcome","welcome message")
# guess = dl.askinteger("Number","Enter a number")
#
# output = "this is output message "
# mb.showinfo("output:",output)

# import web
#
# urls = {
#     '/', 'index'
# }
# app = web.application(urls, globals())
#
#
# class index:
#     def GET(self):
#         greeting = "hellow world"
#         return greeting
#
#
# if __name__ == "__main__":
#     print(app.run())








